package Operateur;
import Monitoring_Machine.*;
import org.omg.CORBA.*;
import org.omg.PortableServer.*;
import IHM.*;




public class OperateurServant extends Monitoring_Machine.OperateurPOA {

	TestIHM IHM;
	//String Liste_args [];
	
	
	public OperateurServant() {
	
	/*	Liste_args = new String[args.length];
		
		for(int i = 0;i< args.length;i++) {
			
			Liste_args[i] = args[i];
		
		}
	*/
		
		
		
		
	}
	
	public void init(String args[]) throws Exception {
	
		ORB orb = ORB.init(args,null);
		
		POA poa = POAHelper.narrow(orb.resolve_initial_references("RootPOA"));
		
		poa.the_POAManager().activate();
		
		OperateurServant servant = new OperateurServant();
		
		org.omg.CORBA.Object obj = poa.servant_to_reference(servant);
		
		String ref = orb.object_to_string(obj);
		
		IO.writeIOR(ref,args[0]);
		
		
		System.out.println("attente requete");
		
		orb.run();
		
		
	}
	
	
	
	
	public void alerte(Type_commande commande,int seuil,String nom_machine){
		
		
		System.out.println("bshatek hamdi "+"\n commande "+EnumUtils.typeCommandeToString(commande)+" ");				
	}
	
	
	
	public static void main (String args[]) throws Exception{  
	
		ORB orb = ORB.init(args,null);
		
		POA poa = POAHelper.narrow(orb.resolve_initial_references("RootPOA"));
		
		poa.the_POAManager().activate();
		
		OperateurServant servant = new OperateurServant();
		
		org.omg.CORBA.Object obj = poa.servant_to_reference(servant);
		
		String ref = orb.object_to_string(obj);
		
		IO.writeIOR(ref,args[0]);
		
		
		System.out.println("attente requete");
		
		orb.run();
	
				
	}


	
}
